<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta charset="UTF-8" />
        <title>患者综合信息</title>
        <link href="/POMR/resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
		<link rel="stylesheet" type="text/css" href="/POMR/resources/font-awesome-4.7.0/css/font-awesome.min.css">
    	<link rel="stylesheet" href="/POMR/resources/LobiPanel/dist/css/lobipanel.min.css"/>
        <script src="/POMR/resources/common/jquery/jquery-3.2.1.min.js"></script>
        <script src="/POMR/resources/bootstrap/js/bootstrap.min.js"></script>
        <script src="/POMR/resources/LobiPanel/dist/js/lobipanel.js"></script>
       <style type="text/css">
       div{
       	border:1px;
       	solid #f00;
       }
       </style>
    </head>
    <body>
    	<div>
	        <ul class="nav nav-pills nav-stacked col-md-2 bg-info" id="myTab" style="height:0px;padding-bottom:100%;">
	            <li class="active"><a class="myTab" href="#divstyle" data-toggle="tab" >户主</a></li>
	            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                    	家庭成员
                    <b class="caret"></b>
                </a>
                <ul class="dropdown-menu bg-info">
                	<c:forEach var="f" items="${family}">
                		<li><a href="#divstyle" class="bg-info myTab" id="${f}"><c:out value="${f}"/></a></li>
                	</c:forEach>
                </ul>
            </li>
	        </ul>
        </div>
        <div class="tab-content  col-md-10 bg-success" style="height:0px;padding-bottom:100%;">
          <!--1-->
          <div class="tab-pane active" id="divstyle">
              <div class="tabbable" style="margin: 3px;">
                  <ul class="nav nav-tabs" id="divstyletab">
                      <li class="active"><a href="#tabcont" data-toggle="tab" id="jbxx">基本信息</a></li>
                      <li><a href="#tabcont" data-toggle="tab" id="tjxx">体检信息</a></li>
                      <li><a href="#tabcont" data-toggle="tab" id="wssj">卫生事件</a></li>
                      <li><a href="#tabcont" data-toggle="tab" id="jzxx">就诊记录</a></li>
                      <li><a href="#tabcont" data-toggle="tab" id="wlwjc">物联网监测</a></li>
                  </ul>
                  <div class="tab-content">
                      <!-- 主显示div 引入页面 -->
                      <div class="tab-pane in active" id="tabcont1">
                      	<!-- 默认基本信息页面-->
                      </div>
                      <!-- 主显示div 引入页面 -->
                      <div class="tab-pane in" id="tabcont">
                      </div>
                  </div>
              </div>
          </div>
      </div>
      <script type="text/javascript">
          $(function() {
          	//页面加载
          	
            $('.myTab').click(function(e) {
            	//TODO 通过ID获取患者基本信息
                e.preventDefault();
                $(this).tab('show');
            });
            $('#divstyletab a').click(function(e) {
            	var tabid =  $(e.target).attr("id")
            	if(tabid == "wlwjc"){//物联网监测
            		var urlready = "http://127.0.0.1:8080/POMR/receive/searchcon.do?cond=555741528972"
            		$.ajax({
		        		url:urlready,
		        		type:'get',
		        		async:false,//异步执行
		        		timeout:5000,//超时时间5s
		        		traditional:true,//防止转义--组合对象默认会被转义无法被springmvc转换
		        		data:JSON.stringify(""),//参数
		        		contentType:'application/json;charset=utf-8',//参数类型
		        		dataType:'html',
		        		cache: false,  //禁用缓存
		        		success:function(data){
	        				$("#tabcont").html(data)
	        				e.preventDefault();
                			$(this).tab('show');
		        		},
		        		error:function(){
		        			alert('服务器无响应 ')
		        		}
		        	});
		        	return true;
            	}
            	var paramjson = {
            		tabid:tabid
            	}
            	$.ajax({
	        		url:'/POMR/healthdata.do',
	        		type:'post',
	        		async:false,//同步执行
	        		timeout:5000,//超时时间5s
	        		traditional:true,//防止转义--组合对象默认会被转义无法被springmvc转换
	        		data:JSON.stringify(paramjson),//参数
	        		contentType:'application/json;charset=utf-8',//参数类型
	        		dataType:'html',
	        		cache: false,  //禁用缓存
	        		success:function(data){
	        			$("#tabcont").html(data)
	        		},
	        		error:function(){
	        			alert('服务器无响应 ')
	        		}
	        	});
                e.preventDefault();
                $(this).tab('show');
            });
            });
      </script>
    </body>
</html>